
<style type="text/css">
#content{/* width:960px; */ margin-top: 0px;}
#top_header_bar{height:363px;}

#loginDiv{width: 930px; margin:125px auto;}
#loginDiv dl{margin:12.5px 0;}
#loginDiv dt, #loginDiv dd{display:inline-block;}
#loginDiv dt{width:200px; text-align:right;}
#loginDiv dt label{font-size: 37.5px;}
#loginDiv dd{width:720px;}
#loginDiv dd .input-text{width: 450px; height:60px; margin-top:25px; border: 2px solid #ccc;}
#loginDiv dd .input-submit{width: 454px; height:64px; margin-top:25px; font-size: 37.5px;}
/* #captcha-element img{position:relative; top:10px; border:1px solid #ccc; cursor:pointer;} */
#member_login_captcha_img{position:relative; top:25px; width:200px; height:60px; border:2px solid #ccc; /* margin:1px 0; */ cursor:pointer;}
#loginDiv dd a.forget-password{display: inline-block; margin-top:25px;}
</style>

<div id="loginDiv">
	<form id="loginForm" action="<?php echo $view_data['mobile_do_login_url']; ?>" method="post" onsubmit="return do_login();">
    	<dl>
            <dt id="mobile-label"><label for="mobile">手机：</label></dt>
            <dd id="mobile-element">
                <input class="input-text" type="text" id="mobile" name="mobile" value="" />
            </dd>
        </dl>
            
        <dl>
            <dt id="password-label"><label for="password">密码：</label></dt>
            <dd id="password-element">
                <input class="input-text" type="password" id="password" name="password" value="" />
            </dd>
        </dl>
            
        <dl>    
            <dt id="captcha-input-label"><label class="required" for="captcha-input">验证码：</label></dt>
            <dd id="captcha-element">
                <input id="member_login_captcha" class="input-text" type="text" name="member_login_captcha" value="" />
                <img id="member_login_captcha_img" src="<?php echo $view_data['login_captcha_url']; ?>" alt="换一张" title="换一张" onclick="refresh_captcha();" />
            </dd>  
        </dl>
            
        <dl>    
            <dt id="submit-label">&nbsp;</dt>
            <dd id="submit-element">
                <input class="input-submit" type="submit" value="登录" /><br/>

                <div class="form_error_message">
                    <span class="form_error_message_mark">!</span>
                    <span class="form_error_message_content"></span>
                </div>

                <a class="forget-password">忘记密码？请联系客服重置密码</a>
            </dd>
        </dl>        
    </form>
</div>

<script type="text/javascript">
function refresh_captcha(){
	var login_captcha_url = "<?php echo $view_data['login_captcha_url']; ?>" + '&random=' + Math.random();
    $('#member_login_captcha_img').attr('src', login_captcha_url);
}

function do_login(){
	$.ajax({
		type: 'POST',
		url: "<?php echo $view_data['mobile_do_login_url']; ?>",
		data: $('#loginForm').serialize(),
		dataType: 'json',
		success: function(rdata){			
			if(rdata.status <= 0){
				refresh_captcha();

				//alert(rdata.message);
                show_form_error_message(rdata.message);
			}else{
				alert(rdata.message);
                window.top.location.replace('<?php echo $this->get_url(array('route' => 'member_index')); ?>');
			}	
			
			return false;	
		}
	});
	
	return false;
}

</script>  